package com.lagou.es.controller;

import com.lagou.es.service.PoisitionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.List;

/**
 * @Description TODO
 * @Classname PoisitionController
 * @Date 2021/8/26 0:52
 * @Author ch'ien
 */
@RestController
@RequestMapping("/es")
public class PoisitionController {

    @Autowired
    private PoisitionService poisitionService;

    @GetMapping("/import")
    public void importData() throws IOException {
        poisitionService.importDataToES();
    }

    @GetMapping("/query")
    public List query(String keyword) throws IOException {
        return poisitionService.query(keyword);
    }
}
